package com.quwan.common.enums;

public enum JobStatusEnum {
    SUCEESS("成功", new Byte((byte)1)),
    FAIL("失败", new Byte((byte)0));

    private String msg;
    private Byte code;

    private JobStatusEnum(String msg, Byte code) {
        this.msg = msg;
        this.code = code;
    }
    public static String getMsgByCode(Byte code){
        JobStatusEnum[] enums = JobStatusEnum.values();
        for (JobStatusEnum jobStatusEnum:enums){
            if(jobStatusEnum.getCode().equals(code)){
                return jobStatusEnum.getMsg();
            }
        }
        return "";
    }

    public static boolean isValidCode(Byte code) {
        for (JobStatusEnum jobStatusEnum : JobStatusEnum.values()) {
            if (code.equals(jobStatusEnum.getCode())) {
                return true;
            }
        }
        return false;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Byte getCode() {
        return code;
    }

    public void setCode(Byte code) {
        this.code = code;
    }
}
